package com.aishua.andpaydemo.diyview;

import android.content.Context;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.aishua.andpaydemo.R;
import com.aishua.andpaydemo.activity.MainActivity;


public class NavigateBarView extends RelativeLayout {
	public static final String TAG = "NavigateBarView-";
	
	private MainActivity mMainActivity = (MainActivity)getContext();
	
	private ImageView img_topline;
	private ImageView img_nav;
	private TextView tv_nav;
	
	public NavigateBarView(Context context) {
		super(context);
		initView();
	}

	public NavigateBarView(Context context, AttributeSet attrs) {
		super(context, attrs);
		initView();
	}
	
	private void initView() {
		LayoutInflater inflater = (LayoutInflater) this.getContext()
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(R.layout.view_navbar_item, this, true);
		
		initNavBarView();
	}
	
	private void initNavBarView() {
		img_topline = (ImageView)findViewById(R.id.img_topline);
    	img_nav = (ImageView)findViewById(R.id.img_nav);
    	tv_nav = (TextView)findViewById(R.id.tv_nav);
    }
	
	public void setImg_toplineVisibile(boolean isVisibile) {
		if (isVisibile) {
			img_topline.setVisibility(View.VISIBLE);
		} else {
			img_topline.setVisibility(View.GONE);
		}
	}
	
	public void setImgNav(int resid) {
		if (null != img_nav) {
			img_nav.setBackgroundResource(resid);
		}
	}
	
	public void setTvNav(String text) {
		if (null != img_nav) {
			tv_nav.setText(text);
		}
	}
	
	public void setTvColor(int color) {
		if (null != img_nav) {
			tv_nav.setTextColor(color);
		}
	}
	
	private Handler mHandler = new Handler() {
		public void handleMessage(android.os.Message msg) {
			switch (msg.what) {
			case 1:
				break;
			default:
				break;
			}
		};
	};
	
}
